home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-08-13 | 955 b | 37 lines |
- import java.applet.Applet;
- import java.awt.*;
-
- public class jshooting extends Applet {
- static final int WIDTH = 240, HEIGHT = 320; // 背景サイズ
- SpriteControl sc; // スプライトコントロール
- MediaTracker mt;
- public void init(){
- sc = new SpriteControl( 1, 1, WIDTH, HEIGHT, this );
- mt = new MediaTracker( this );
- Image image = getImage( getDocumentBase(), "img/back.gif" ); // 背景
- mt.addImage( image, 0 );
- sc.SetBGImage( image );
- image = getImage( getDocumentBase(), "img/myship.gif" ); // 自機
- mt.addImage( image, 0 );
- sc.Define( 0, image );
- sc.Set( 0, 0 );
- sc.Move( 0, (WIDTH-32)/2, (HEIGHT-32)/2 );
- sc.Show();
- try {
- mt.waitForID( 0 );
- } catch( InterruptedException e ){
- return;
- }
- }
- public void update( Graphics g ){
- paint( g );
- }
- public void paint( Graphics g ){
- if( mt.checkID( 0 ) ){
- sc.Display( g, this );
- } else {
- g.drawString( "Loading...", 0, 12 );
- }
- }
- }
-